package com.dodayum.controller;

import cn.hutool.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @version 1.0
 * 备注：
 * @Author BaiYu
 * </br>@Date 2025/1/7 10:45
 */
@RestController
@RequestMapping("/common")
@Slf4j
public class DemoController {

    @GetMapping("/demo")
    public String demo(@RequestHeader("aaa") String token,@RequestParam String demo) {
        System.out.println(demo);
        return demo;

    }

    @PostMapping("/login")
    public Map<String, Object> login(@RequestParam String userName,@RequestParam String password) throws InterruptedException {
        log.info("userName:{}\tpassword:{}",userName,password);
        Map<String, Object> response = new HashMap<String, Object>(){{
            put("code",0);
            put("msg",null);
            put("date",new HashMap<String,String>(){{
                put("token", IdUtil.simpleUUID());
            }});
        }};
        Thread.sleep(1100);
        return response;
    }

}